package com.pureut.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.pureut.common.security.utils.SecurityUtils;
import com.pureut.system.domain.FileTypeManagement;
import com.pureut.system.domain.vo.FileTypeManagementVo;
import com.pureut.system.mapper.FileTypeManagementMapper;
import com.pureut.system.service.IFileTypeManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Author: pureut
 * @Date: 2024-12-06 13:51:19
 * @Desc: 文件类型管理
 */
@Service("fileTypeManagementService")
public class FileTypeManagementServiceImpl extends ServiceImpl<FileTypeManagementMapper, FileTypeManagement> implements IFileTypeManagementService {

    /**
     * 文件类型管理Dao
     */
    @Autowired
    private FileTypeManagementMapper fileTypeManagementDao;

    /**
     * 查询列表
     * @param fileTypeManagementVo
     * @return
     */
    @Override
    public List<FileTypeManagement> queryPage(FileTypeManagementVo fileTypeManagementVo) {
//        Page<FileTypeManagement> result = fileTypeManagementDao.selectPage(page, wrapper);
        // 总数、结果
       return null;
    }


    /**
     * 新增文件类型管理
     * @param fileTypeManagementVo
     * @return
     */
    @Override
    public Boolean save(FileTypeManagementVo fileTypeManagementVo) {
        FileTypeManagement fileTypeManagement = new FileTypeManagement();
        BeanUtil.copyProperties(fileTypeManagementVo, fileTypeManagement);
        fileTypeManagement.setCreateBy(SecurityUtils.getUsername());
        fileTypeManagement.setCreateTime(new Date());
        return save(fileTypeManagement);
    }


    /**
     * 更新文件类型管理
     * @param fileTypeManagementVo
     * @return
     */
    @Override
    public Boolean updateById(FileTypeManagementVo fileTypeManagementVo) {
        FileTypeManagement fileTypeManagement = new FileTypeManagement();
        BeanUtil.copyProperties(fileTypeManagementVo, fileTypeManagement);
        fileTypeManagement.setUpdateBy(SecurityUtils.getUsername());
        fileTypeManagement.setUpdateTime(new Date());
        return updateById(fileTypeManagement);
    }
}
